import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)


//官方配置：解决 VueRouter 中同一路由多次切换报错问题
const original = Router.prototype.push;
Router.prototype.push = function push(location) {
    return original.call(this, location).catch(err => err)
};

export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/index'
        },
        //主页路由
        {
            path: '/index',
            component: () => import('../views/Index'),
            name: 'Index',
        },
        //用户管理路由
        {
            path: '/users',
            component: () => import('../views/user/Users'),
            name: 'Users'
        }
    ]
})
